dojo.provide("miaigo.model.sgf.values.LineValueHandler");

dojo.require("miaigo.model.sgf.values.PointValueHandler");

dojo.declare(
    "miaigo.model.sgf.values.LineValueHandler",
    [miaigo.model.sgf.values.ValueHandler],
    {
	_valueType: "Line",

	_pointValueHandler: null,

	constructor: function()
	{
	    this._pointValueHandler = new miaigo.model.sgf.values.PointValueHandler();
	},

	// Return: {start: <point>, end: <point>}
	// where point is {x: 6, y: 9}, defined in PointValueHandler
	parseValue: function(/* Array */values)
	{
	    var value = values[0];

	    if (value)
	    {
		var points = value.split(":");
		if (points.length == 2 &&
		    points[0].length == 2 &&
		    points[1].length == 2)
		{
		    var start = this._pointValueHandler.parseValue([points[0]]);
		    var end = this._pointValueHandler.parseValue([points[1]]);
		    return {start: start, end: end};
		}
	    }
	}
    });